package com.mondo.financialwallet.data.net;

import com.mondo.financialwallet.data.entity.BasisResponseEntity;
import com.mondo.financialwallet.data.entity.MyTokenListEntity;
import com.mondo.financialwallet.data.entity.TokenAddressEntity;
import com.mondo.financialwallet.data.entity.TokenTransactionRecordEntity;
import com.mondo.financialwallet.data.entity.WalletAssetEntity;

import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * 钱包服务器
 */
public interface WalletWebApi {

    /**
     * 资产
     */
    @GET("wallet/asset")
    Observable<WalletAssetEntity> asset();

    /**
     * 我的数字货币
     */
    @GET("wallet/list")
    Observable<MyTokenListEntity> myTokenList();

    /**
     * 资产余额
     */
    @GET("wallet/available_asset")
    Observable<WalletAssetEntity> assetAvailable();

    /**
     * 购买理财产品
     */
    @FormUrlEncoded
    @POST("wallet/financing")
    Call<BasisResponseEntity> generateFinancingOrder(
            @Field("goods_id") String goodsId, @Field("usd_amount") String amount
    );

    /**
     * 获取钱包地址
     */
    @GET("wallet_address/get")
    Observable<TokenAddressEntity> generateTokenAddress(@Query("token_id") String tokenId);

    /**
     * 转账
     */
    @FormUrlEncoded
    @POST("wallet/transfer")
    Observable<BasisResponseEntity> transfer(
            @Field("token_id") String tokenId, @Field("number") String number,
            @Field("to") String address, @Field("remark") String remark
    );

    /**
     * Token交易记录
     */
    @GET("wallet_history/list")
    Observable<TokenTransactionRecordEntity> transactionRecordList(
            @Query("page_index") int index, @Query("page_size") int size, @Query("income") String income,
            @Query("token_id") String tokenId
    );
}
